package cn.hnu.qq.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import cn.hnu.qq.entity.message.Message;

@Entity
public class ChartContent extends Message{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Integer id ;
	
	private User Owner;

	private User charter;
	private Crowd crowd;
	
	private String content = "";
	
	private Date time;

	@ManyToOne(cascade={CascadeType.MERGE})
	public User getOwner() {
		return Owner;
	}

	public void setOwner(User owner) {
		Owner = owner;
	}

	@ManyToOne(cascade={CascadeType.MERGE})
	public User getCharter() {
		return charter;
	}

	public void setCharter(User charter) {
		this.charter = charter;
	}
	@ManyToOne(cascade={CascadeType.MERGE})
	public Crowd getCrowd() {
		return crowd;
	}

	public void setCrowd(Crowd crowd) {
		this.crowd = crowd;
	}


	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	@Column(length = 10000)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Override
	public String toString() {
		return "ChartContent [time=" + new SimpleDateFormat("yyyy_MM_DD_HH_mm_ss").format(time) + "]";
	}

	@Id  @GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
}
